﻿//-----------------------------------------------------------------------
// <copyright file="ScheduleHistory.cs" company="FastNET Services">
//     Copyright (c) 2008-2009. All Rights Reserved.
// </copyright>
// <license>
//     GPLv2
// </license>
// <warranty>
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//     BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//     DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </warranty>
//-----------------------------------------------------------------------
#region Usings
using System;
using FastNET.CleanAct.Common.Repository;
using FastNET.CleanAct.Common.Repository.Business;
using FastNET.CleanAct.Common.Repository.Interfaces.DataInterfaces.ManagementEngine;
using FastNET.CleanAct.Common.Repository.Interfaces.Factories;
using FastNET.CleanAct.Common.Repository.Interfaces.Repositories.ManagementEngine;

#endregion

namespace FastNET.CleanAct.Client.ManagerEngineBusiness.DataObjects
{
    /// <summary>
    /// Business Class representing a Schedule History for the client
    /// </summary>
    public class ScheduleHistory : IdentityBusinessBase<IScheduleHistoryData, IScheduleHistoryRepository>
    {
        #region AutoLoaded Property Fields



        #endregion

        #region Public CTor/DTor

        /// <summary>
        /// Initializes a new instance of the ScheduleHistory class
        /// </summary>
        public ScheduleHistory()
            : this(new RepositoryFactory())
        {

        }

        /// <summary>
        /// Initializes a new instance of the ScheduleHistory class
        /// </summary>
        /// <param name="ID">Identity of the data to retrieve</param>
        public ScheduleHistory(Identity ID)
            : this(new RepositoryFactory(), ID)
        {
        }

        #endregion

        #region Internal CTor/DTor

        /// <summary>
        /// Initializes a new instance of the ScheduleHistory class
        /// </summary>
        /// <param name="factory">Factory for retrieving the Repository from</param>
        /// <param name="data">Data for backing the business object</param>
        /// <exception cref="ArgumentNullException">Thrown if Factory or Data are null</exception>
        internal ScheduleHistory(IRepositoryFactory factory, IScheduleHistoryData data)
            : base(factory, data)
        {
        }

        /// <summary>
        /// Initializes a new instance of the ScheduleHistory class
        /// </summary>
        /// <param name="factory">Factory for retrieving the Repository from</param>
        /// <exception cref="ArgumentNullException">Thrown if Factory is null</exception>
        internal ScheduleHistory(IRepositoryFactory factory)
            : base(factory)
        {
        }

        /// <summary>
        /// Initializes a new instance of the ScheduleHistory class
        /// </summary>
        /// <param name="factory">Factory for retrieving the Repository from</param>
        /// <param name="ID">Identity of the data to retrieve</param>
        /// <exception cref="ArgumentNullException">Thrown if Factory is null</exception>
        internal ScheduleHistory(IRepositoryFactory factory, Identity ID)
            : base(factory, ID)
        {
        }

        #endregion

        #region Overrides of BusinessBase<IScheduleHistoryData,IScheduleHistoryRepository>

        /// <summary>
        /// Method to check whether or not the current object is valid
        /// </summary>
        /// <returns>Boolean based on the validity of the object</returns>
        public override bool IsValid()
        {
            return true;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the schedule the history item is associated with
        /// </summary>
        public Identity ScheduleID
        {
            get
            {
                return Data.ScheduleID;
            }

            set
            {
                Data.ScheduleID = value;
            }
        }

        /// <summary>
        /// Gets or sets the time the schedule started
        /// </summary>
        public DateTime StartTimeStamp
        {
            get
            {
                return Data.StartTimeStamp;
            }

            set
            {
                Data.StartTimeStamp = value;
            }
        }

        /// <summary>
        /// Gets or sets the time the schedule stopped
        /// </summary>
        public DateTime? StopTimeStamp
        {
            get
            {
                return Data.StopTimeStamp;
            }

            set
            {
                Data.StopTimeStamp = value;
            }
        }

        /// <summary>
        /// Gets or sets the result code for the history item
        /// </summary>
        public ScheduleHistoryResult? Result
        {
            get
            {
                return (ScheduleHistoryResult)Data.Result;
            }

            set
            {
                Data.Result = (byte?)value;
            }
        }

        #endregion
    }
}